package dao

import (
	"26day12/inits"
	"26day12/models"
)

func CreateMessage(FormUserId int, ToUserId int, message string) bool {
	var min1 = FormUserId
	var max1 = ToUserId

	if FormUserId > ToUserId {
		min1 = ToUserId
		max1 = FormUserId
	}
	m := models.Message{
		FormUserId: FormUserId,
		ToUserId:   ToUserId,
		RoomId:     min1*100000 + max1,
		Context:    message,
	}

	if inits.DB.Debug().Create(&m).Error != nil {
		return false
	}
	return false
}

func List() {

}
